FROM python:3.7.4-buster
MAINTAINER zhuwenshen<1204621904@qq.com>

#时区
ENV  TZ='Asia/Shanghai'  
RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime \  
	&& echo $TZ > /etc/timezone

#pip源
ENV PIP_CONF='/etc/pip.conf'
RUN touch $PIP_CONF \
	&& chmod 755 $PIP_CONF \
	&& echo '[global]' >> $PIP_CONF \
	&& echo 'trusted-host=mirrors.aliyun.com' >> $PIP_CONF \
	&& echo 'index-url=https://mirrors.aliyun.com/pypi/simple' >> $PIP_CONF	

WORKDIR /app

# 激活的模型类型
ENV ACTIVE_MODEL_TYPE=''

# 安装git
#RUN apt-get update \
#    && apt-get install -y git

#RUN apt-get update \
#    && apt-get install -y apt-utils \
#    && apt-get install -y tesseract-ocr libtesseract-dev 

# 日志缓存为1，即实时日志
ENV PYTHONUNBUFFERED=1

#COPY discern_code/* .
COPY . .

RUN rm -rf .git test tag

#COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

CMD [ "python", "./server-api.py" ]

#build
#docker build -t registry.cn-hangzhou.aliyuncs.com/zhuwenshen/discern_code:2.0.1 .
#docker build -t registry.cn-hangzhou.aliyuncs.com/zhuwenshen/discern_code:qunar.0.1 .
#docker build -t registry.cn-hangzhou.aliyuncs.com/zhuwenshen/discern_code:sdhk.0.1 .
#run
#docker run --name discern_code -p 80:80 -m 300M --log-opt max-size=300m --log-opt max-file=3 registry.cn-hangzhou.aliyuncs.com/zhuwenshen/discern_code:1.0.1

#docker run --name discern_code -p 80:80  registry.cn-hangzhou.aliyuncs.com/zhuwenshen/discern_code:1.0.1
#docker run --rm --name discern_code -p 80:80 -e ACTIVE_MODEL_TYPE='zfb' registry.cn-hangzhou.aliyuncs.com/zhuwenshen/discern_code:1.0.1